package cn.gov.pbc.address.controller;

import java.math.BigDecimal;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.gov.pbc.address.common.ServerResponse;
import cn.gov.pbc.address.pojo.Address;
import cn.gov.pbc.address.service.IAddressService;
import lombok.extern.slf4j.Slf4j;

@RequestMapping("/")
@RestController
@Slf4j
public class AddressController {
	
	@Autowired
	private IAddressService iAddressService;

	@RequestMapping(value = "getAddress.do", method = RequestMethod.POST)
	public ServerResponse<?> getAddress() {
		return iAddressService.selectAll();
	}
	
	@RequestMapping(value = "updateLngLat.do", method = RequestMethod.POST)
	public ServerResponse<?> updateLngLat(@RequestBody Address address){
		return this.iAddressService.updateLngLat(address.getId(), address.getLng(), address.getLat());
	}
}
